import request from '@/utils/request'

const api_name = '/serviceEdu/teacher'

export default {

    // 讲师列表（条件查询分页）
    getPageTeacherList(page, limit, searchObj){
        return request({
            url: `${api_name}/pageTeacherCondition/${page}/${limit}`,
            method: 'post',
            // searchObj条件对象，后端使用RequestBody获取数据，前端需要使用data传数据
            data: searchObj
        })
    },

    // 根据id删除讲师
    removeTeacher(teacherId){
        return request({
            url: `${api_name}/${teacherId}`,
            method: 'delete'
        })
    },
    
    // 添加讲师
    addTeacher(teacher){
        return request({
            url: `${api_name}/addTeacher`,
            method: 'post',
            data: teacher
        })
    },

    // 根据id查询讲师
    getTeacherById(id){
        return request({
            url: `${api_name}/getTeacher/${id}`,
            method: 'get'
        })
    },

    // 根据id修改讲师
    updateTeacher(teacher){
        return request({
            url: `${api_name}/updateTeacher`,
            method: 'post',
            data: teacher
        })
    },

    // 查询所有讲师
    getList() {
        return request({
            url: `${api_name}/findAll`,
            method: 'get'
        })
    }

}